package com.hooya.fa.eu.biz.controller;

import com.hooya.fa.eu.api.vo.PkVO;
import com.hooya.fa.eu.biz.service.InventoryService;
import com.hooya.integrated.common.core.util.R;
import com.hooya.integrated.common.security.annotation.Inner;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description 1
 * @Author : Zongz
 * @Copyright Copyright (c) 豪雅集团
 * @Create 2025/1/22
 * @Version 1.1.0
 */
@Validated
@RestController
@Tag(name = "库存相关")
@RequiredArgsConstructor
@RequestMapping("/inventory")
public class InventoryController {

    private final InventoryService inventoryService;

    @Inner(value = false)
    @PostMapping("/even/up")
    @Operation(summary = "平仓【√】", hidden = true, description = "根据库存记录某一日的日期平仓结果")
    public R evenUp(@RequestParam("date") String date) {
        inventoryService.evenUp(date);
        return R.ok();
    }

    @Inner(value = false)
    @GetMapping("/even/up")
    @ResponseExcel(name = "平仓结果")
    @Operation(summary = "导出平仓结果【√】", hidden = true, description = "导出平仓结果")
    public List<PkVO> evenUpReport() {
        return inventoryService.evenUpReport();
    }

}
